package org.discala.util.logging

/**
 * @author Chris Turner
 */
trait LoggerUtils {

  def parameteriseMessage(message: String, params: List[Any]): String = {
    params match {
      case Nil => message
      case param :: others => {
        if ( message.contains("{}"))
          parameteriseMessage(message.replaceFirst("""\{\}""", escapeDollar(param)), others)
        else message
      }
    }
  }

  private def escapeDollar(param: Any) = param.toString.replaceAll("""\$""", """\\\$""")
}